package com.aircms.dao;

import com.aircms.pojo.Users;
import com.aircms.pojo.validation.BaseQueryFieldsValidation;
import com.aircms.pojo.vo.UserRoleVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
public interface UsersMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Users record);

    int insertSelective(Users record);

    Users selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Users record);

    int updateByPrimaryKey(Users record);

    /**
     * 根据用户名和密码查询用户信息
     * @param name
     * @param password
     * @return
     */
    Users selectByNameAndPassword(@Param("name") String name, @Param("password") String password);

    /**
     * 根据id和密码查询用户信息
     * @param id
     * @param password
     * @return
     */
    Users selectByIdAndPassword(@Param("id") Integer id, @Param("password") String password);

    int checkNameExist(String name);

    /**
     * 检查除了此id 以外还有么有么此name
     * @param name
     * @param id
     * @return
     */
    int checkNameExistExceptId(@Param("name") String name ,@Param("id") Integer id);

    List<Users> selectAll(BaseQueryFieldsValidation baseQueryFields);

    UserRoleVo selectUserRoles(Integer userId);


    int setStatus(@Param("id") Integer id, @Param("status") Integer status);

}